home *** CD-ROM | disk | FTP | other *** search
/ Programming Microsoft Visual Basic .NET / Programming Microsoft Visual Basic .NET (Microsoft Press)(X08-78517)(2002).bin / setup / vbnet / 23 web forms and controls / databinding / datalistform.aspx < prev    next >
Encoding:
ASP.NET Web Form  |  2002-03-17  |  5.3 KB  |  102 lines

  1. <%@ Page Language="vb" AutoEventWireup="false" Codebehind="DataListForm.aspx.vb" Inherits="DataBinding.DataListForm" trace="True" %>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  3. <HTML>
  4.     <HEAD>
  5.         <title>DataListForm</title>
  6.         <meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
  7.         <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
  8.         <meta content="JavaScript" name="vs_defaultClientScript">
  9.         <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
  10.     </HEAD>
  11.     <body>
  12.         <form id="Form1" method="post" runat="server">
  13.             <H1 style="FONT-SIZE: large; FONT-FAMILY: 'Arial Black'">DataList Control Demo</H1>
  14.             <P style="FONT-SIZE: large; FONT-FAMILY: 'Arial Black'"><FONT face="Times New Roman" size="3">The 
  15.                     first DataList control on this page demonstrates several features of the 
  16.                     DataList control, including  select and edit templates. The second 
  17.                     DataList demonstrates that you can render its contents using any layout (not 
  18.                     necessarily an HTML table); you can use it to display all the image files in a 
  19.                     directory on the server that you select.</FONT></P>
  20.             <HR width="100%" SIZE="1">
  21.             <P style="FONT-SIZE: large; FONT-FAMILY: 'Arial Black'">A DataList displaying books</P>
  22.             <P>
  23.                 <asp:datalist id="dlstBooks" runat="server" Width="538px">
  24.                     <HeaderTemplate>
  25.                         <DIV style="COLOR: white; FONT-FAMILY: 'Arial Black'; BACKGROUND-COLOR: navy">Click 
  26.                             on [X] to select and edit a book</DIV>
  27.                     </HeaderTemplate>
  28.                     <SelectedItemTemplate>
  29.                         <DIV style="BACKGROUND-COLOR: blue">Title:
  30.                             <asp:Label id=Label7 runat="server" Width="547px" Text='<%# Container.DataItem("Title") %>' Font-Bold="True">
  31.                             </asp:Label><BR>
  32.                             Publisher:
  33.                             <asp:Label id=lblPublisher runat="server" Width="170px" Text='<%# Container.DataItem("pub_name") %>' Font-Bold="True">
  34.                             </asp:Label>Type:
  35.                             <asp:Label id=lblType runat="server" Width="168px" Text='<%# Container.DataItem("Type") %>' Font-Bold="True">
  36.                             </asp:Label>Price:
  37.                             <asp:Label id=lblPrice runat="server" Width="83px" Text='<%# Container.DataItem("Price") %>' Font-Bold="True">
  38.                             </asp:Label>
  39.                             <asp:Button id="Button2" runat="server" Text="Edit" CommandName="Edit"></asp:Button> 
  40.                             <asp:Button id="Button4" runat="server" Text="Delete" CommandName="delete"></asp:Button> 
  41.                         </DIV>
  42.                     </SelectedItemTemplate>
  43.                     <FooterTemplate>
  44.                         <DIV style="COLOR: white; FONT-FAMILY: 'Arial Black'; BACKGROUND-COLOR: navy">End 
  45.                             of list</DIV>
  46.                     </FooterTemplate>
  47.                     <ItemTemplate>
  48.                         <asp:LinkButton id="Linkbutton3" runat="server" CommandName="select">[X]</asp:LinkButton> 
  49.                         <asp:Label id=Label5 runat="server" Width="559px" Text='<%# Container.DataItem("Title") %>'>
  50.                         </asp:Label>
  51.                     </ItemTemplate>
  52.                     <AlternatingItemTemplate>
  53.                         <DIV style="BACKGROUND-COLOR: yellow">
  54.                             <asp:LinkButton id="Linkbutton4" runat="server" CommandName="select">[X]</asp:LinkButton> 
  55.                             <asp:Label id=Label6 runat="server" Width="561px" Text='<%# Container.DataItem("Title") %>'>
  56.                             </asp:Label></DIV>
  57.                     </AlternatingItemTemplate>
  58.                     <EditItemTemplate>
  59.                         <DIV style="BACKGROUND-COLOR: blue">Title:
  60.                             <asp:TextBox id=txtTitle runat="server" Width="500px" Text='<%# Container.DataItem("Title") %>'>
  61.                             </asp:TextBox><BR>
  62.                             Publisher:
  63.                             <asp:Literal id=litPubId Text='<%# Container.DataItem("pub_id") %>' Visible="False" Runat="server">
  64.                             </asp:Literal>
  65.                             <asp:DropDownList id="ddlPublishers" runat="server" Width="170px" DataTextField="pub_name" DataValueField="pub_id"></asp:DropDownList>Type:
  66.                             <asp:TextBox id=txtType runat="server" Width="168px" Text='<%# Container.DataItem("Type") %>'>
  67.                             </asp:TextBox>Price:
  68.                             <asp:TextBox id=txtPrice runat="server" Width="83px" Text='<%# Container.DataItem("Price") %>'>
  69.                             </asp:TextBox>
  70.                             <asp:Button id="Button1" runat="server" Text="Update" CommandName="update"></asp:Button> 
  71.                             <asp:Button id="Button3" runat="server" Text="Cancel" CommandName="cancel"></asp:Button> 
  72.                         </DIV>
  73.                     </EditItemTemplate>
  74.                 </asp:datalist></P>
  75.             <P> </P>
  76.             <P style="FONT-SIZE: large; FONT-FAMILY: 'Arial Black'">A DataList displaying 
  77.                 images</P>
  78.             <P style="FONT-SIZE: medium">Type a directory path:
  79.                 <asp:TextBox id="txtPath" runat="server" Width="306px"></asp:TextBox>
  80.                 <asp:Button id="btnDisplay" runat="server" Width="109px" Text="Display Images"></asp:Button></P>
  81.             <P>
  82.                 <asp:DataList id="dlstFiles" runat="server" RepeatDirection="Horizontal" RepeatColumns="4">
  83.                     <ItemTemplate>
  84.                         <P>
  85.                             <asp:Image id=imgFile runat="server" Width="140px" ImageUrl="<%# Container.DataItem %>" BorderWidth="1" Height="100px">
  86.                             </asp:Image><BR>
  87.                             <asp:CheckBox id=chkFile runat="server" Text="<%# System.Io.Path.GetFileName(Container.DataItem) %>">
  88.                             </asp:CheckBox></P>
  89.                     </ItemTemplate>
  90.                 </asp:DataList></P>
  91.             <P>
  92.                 <asp:Button id="btnDisplayFileNames" runat="server" Text="Display names of selected files"></asp:Button></P>
  93.             <P>
  94.                 <asp:Repeater id="rptFilenames" runat="server">
  95.                     <ItemTemplate>
  96.                         <%# Container.DataItem %><br />
  97.                     </ItemTemplate>
  98.                 </asp:Repeater></P>
  99.         </form>
  100.     </body>
  101. </HTML>
  102.